//引入路由ApI

import { createRouter,createWebHistory} from "vue-router";
//引入页面
const Home=()=>import('@/views/Home.vue')
const About=()=>import('@/views/about.vue')
const userCenter=()=>import('@/views/user-center/index.vue')
const userProfile=()=>import('@/views/user-center/Profile.vue')
const userSettings = () => import("@/views/user-center/settings.vue")


//配置路由路径，页面
const routeConfig =[
    {
        path:'/Home',//当路径结尾为/home时就会跳转到home页面
        name :'home',
        component:Home
    },
    {
        path:'/About',
        name:'about',
        component:About
    },

    //用户中心
    {
        path: '/index',
        name: 'index',
        component: userCenter,//这是引入他的页面
        redirect: '/index/profile',//当点击主页面（index）是默认子页面重定向到profile页面
        children: [
          {
            path: 'Profile',
            name: 'profile',
            component: userProfile
          },
          {
            path: 'settings',
            name: 'settings',
            component: userSettings
          },
        ]
      },
    
]
//创建一个路由对象
const router=createRouter({
    history:createWebHistory(),//这里是固定格式
    routes:routeConfig
})
//对外暴露
export default router//就的导出该文件